// 文件路径：src/main/java/org/zachary/creditbusiness/hotel/exception/BusinessException.java
package org.zachary.creditbusiness.hotel.exception;

import lombok.Getter;

/**
 * 业务异常，用于提示可被前端友好展示的错误信息。
 */
@Getter
public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    /**
     * 业务错误码，默认 400
     */
    private final int code;

    /**
     * 构造一个默认错误码为 400 的业务异常
     * @param message 错误描述
     */
    public BusinessException(String message) {
        super(message);
        this.code = 400;
    }

    /**
     * 构造一个带自定义错误码的业务异常
     * @param code 错误码
     * @param message 错误描述
     */
    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }
}

